Logo

A Technical Note for Matlab Implementation

This note provides some information for implementing Matlab programs. Due to intensive computation, some .m files require significant time to execute. However, running the same .m file takes different time in different versions of Matlab. Among all the .m files written in my research, significant differences might appear in two types of files if different versions of Matlab are used. The first is the file which heavily uses the vpa function (variable-precision arithmetic), such as table1.m in “ Indefinite Integration of the Gamma Integral”. The second is the file which intensively calls the quadprog function (quadratic programming), such as experiment1.m in “Fixing Boundary Violations”. To see what difference it makes, I test these two files, table1.m and experiment1.m (only 50 samples are used), in different versions of Matlab with two different operating systems, Window XP and Window 7.

This test is carried out on two notebooks. Notebook A has an Intel Core Processor T8300 (2.4GHz) with 4GB Ram, and the operating system is 32-bit Window XP. Notebook B has an Intel Core i5 -2410M CPU (2.30GHz) with 6GB Ram, and it is installed with 64-bit Window 7. To avoid any interference, none of other application programs is executed during the test. In addition, since the first run of both .m files might take longer due to the initialization, I report the testing result of the second run. Notice that the vpa function might has bugs in some Matlab versions. If that happens, I replace with the vpa function of the R2010b version. 

Bear in mind that it takes different time even running the same file on the same computer. So the result I reported is simply based on my one-shot experiment. You should not expect to get the exact same result. However, most of the results are fairly close if the same .m file is executed with the same version of Matlab. In this sense, we need to allow certain margin of errors and only the results that show a great margin of difference (e.g. 100 seconds) will be regarded significant.  

The following table reports the testing results:

testmatlab

Some conclusions can be made from the above test:

  1. If the vpa function is executed, R2010a or later version is recommended for both operating systems.
  2. If the quadprog function is executed, R2009b or earlier version is recommended for both operating systems.
  3. Generally speaking, running the same version of Matlab in 64-bit Window 7 is not faster than in 32-bit Window XP.
Download this note

Download [full paper] [supplementary materials] [.m files] [technical note]